static void add_item(const char* item, bool act) { //text + level operation
    item_count++;
    menu[item_count].item_name = (char*)item;
    menu[item_count].action = act;
    menu[item_count].type = 0;
}

static void add_toggle(const char* item, bool pointer) { // text + swith
    item_count++;
    menu[item_count].item_name = (char*)item;
    menu[item_count].action = true;
    menu[item_count].type = 1;
    menu[item_count].value = pointer;
}

static void add_number(const char* item, int curr_value, int maxvalue) { //text + int curent + max
    item_count++;
    menu[item_count].item_name = (char*)item;
    menu[item_count].action = true;
    menu[item_count].type = 2;
    menu[item_count].ival = curr_value;
    menu[item_count].imaxval = maxvalue;
}

static void add_names(const char* item,int id) { //text + int curent + max
    item_count++;
    menu[item_count].item_name = (char*)item;
    menu[item_count].action = true;
    menu[item_count].type = 2;
    menu[item_count].ival = id;
    //menu[item_count].imaxval = maxvalue;
}

void do_vehicles_list(){
int id = 400;
for (int i = 0; i <= 211; i++) {
	const char* car = GetMyVehicleName(i);
    add_names(car,id);
    id++;
}
}

void do_weapons_list(){
int id = 0;
for (int i = 0; i <= 45; i++) {
	const char* car = weaponNames[i];
    add_names(car,id);
    id++;
}
}

static void add_cheat_call(DWORD addr, const char* item, bool act) {
    item_count++;
    menu[item_count].item_name = (char*)item;
    menu[item_count].action = true;
    menu[item_count].type = 0;
    menu[item_count].pAddr = addr;
    menu[item_count].ival = 0;
}

static void add_cheat_flag(DWORD addr, const char* item, bool act) {
    item_count++;
    menu[item_count].item_name = (char*)item;
    menu[item_count].action = true;
    menu[item_count].type = 1; //bool
    menu[item_count].pAddr = addr; //put cheats addr at array
    int state = *(unsigned char*)addr; //get state at addr
    menu[item_count].ival = state; //put state at array
}

static void menu_setup(void) {
    item_count = 0;
    //menu_len = 0;

    footer = (char*)" ";

    if (menu_level == 0) {
        footer = (char*)"Main Menu";
        add_item("Player Options >", 0);
        add_item("Vehicle Options >", 0);
        add_item("Weapon options >", 0);
        add_item("Teleport options >", 0);
        add_item("game options >", 0);
        add_item("Credits >", 0);
        //DWAW_TYPE = 0;

        return;
    }
    if (menu_level == 1) {
        if (last_selected[0] == 1) {
            footer = (char*)"Player";
            add_item("Add Health", true);
            add_item("Add armour", true);
            add_item("max Health bar", true);
            add_toggle("Gigantic Health", gigant_health);
            add_toggle("god_mode", god_mode);
            add_toggle("Never_wanted", Never_wanted);
            add_item("wanted ++", true);
            add_item("wanted --", true);
            return;
        }
        
        
        if (last_selected[0] == 2) {
            footer = (char*)"Vehicle";
            add_item("Vehicle spawner >", 0);
            return;
        }
        if (last_selected[0] == 3) {
            footer = (char*)"Weapons";
           add_item("Weapons list >", 0);
           add_toggle("Infinite ammo",bInfAmmo );
           add_toggle("Super Range", &super_range);
           add_toggle("Super Damage", &super_damage);
           add_toggle("Super Accuracy", &super_Accuracy);
           add_toggle("Super Shot Speed", &super_speed);
           add_toggle("Dual AK-47", &dual_ak47);
           add_toggle("Explosive ammo", &explosive_ammo);
           add_toggle("Weapons fire Rockets", &rocket_mode_active);
           add_toggle("Heat-Seeking Weapons", &heat_seeking_active);
           
           
            //DWAW_TYPE = 0;
            return;
        }
        if (last_selected[0] == 4) {
            footer = (char*)"Teleport";
            add_item("xxxxxxxxxxxxx >", true);
            return;
        }
        if (last_selected[0] == 5) {
            footer = (char*)"Game";
            add_item("Cheats", 0);
            add_item("Gangs", 0);
            return;
        }
        if (last_selected[0] == 6) {
            footer = (char*)"Credits";
            add_item("Mod menu Creator Fan Script", true);
            add_item("Helpers", true);
            add_item("- AI", true);
            add_item("- Plugin Sdk", true);
            add_item("Compatybile with Game GTA SA v1.0", true);
            add_item("Trainer Writed On like xmc Menu Base-", true);
            add_item("Project Emmanuel Utomi Xmc trainer", true);
            return;
        }
    }
    if (menu_level == 2) {
        if (last_selected[0] == 2) {
            if (last_selected[1] == 1) {
                footer = (char*)"Vehicles List";
                do_vehicles_list();
                return;
            }
        }
        if (last_selected[0] == 3) {
            if (last_selected[1] == 1) {
                footer = (char*)"Weapons list";
                do_weapons_list();
                return;
            }
            if (last_selected[1] == 2) {
                footer = (char*)"CWeapons Base";
                add_item("xxxxxxxxxxxxx >", true);


                return;
            }
        }
        if (last_selected[0] == 5) {
        	if (last_selected[1] == 1) {
        		footer = (char*)"GTA SA CHEATS";
        		add_item("Guns, Health, Armor & Money ~>~",false);
                add_item("Police, Stats & Gangs ~>~",false);
                add_item("Spawning Objects ~>~",false);
                add_item("Vehicles ~>~",false);
                add_item("Gameplay ~>~",false);
                add_item("Weather & Time ~>~",false);
			}
			if (last_selected[1] == 2) {
        		footer = (char*)"Gangs Config";
        		add_item("- ~b~~h~(proc) Defensive Gang War",true);
                add_item("- ~y~~h~(proc) Offensive Gang War",true);
                add_item("- ~r~~h~(proc) End Gang Wars",true);
                add_item("- Gangland",true);
			}
		}
    }
    if (menu_level == 3) {
    	if (last_selected[0] == 5) {
        	if (last_selected[1] == 1) {
        		    if (last_selected[2] == 1) {
            
        
        //=============================================
            add_cheat_call(0x4385B0, "Weapon Set 1, Thug's Tools",true);
            add_cheat_call(0x438890, "Weapon Set 2, Professional Tools",true);
            add_cheat_call(0x438B30, "Weapon Set 3, Nutter Tools",true);
            add_cheat_call(0x438E40, "Health, Armor, $250k",true);
            add_cheat_flag(0x96916D, "Semi-Infinite Health",true);
            add_cheat_flag(0x96916E, "Infinite Oxygen",true);
            add_cheat_call(0x439880, "Adrenaline Mode",true);
            add_cheat_flag(0x969178, "Infinite Ammo, No Reload",true);
    }
    if (last_selected[2] == 2) {
        
        //=============================================
            add_cheat_call(0x438E90, "Increase Wanted Level Two Stars",true);
            add_cheat_call(0x438F20, "Clear Wanted Level",true);
            add_cheat_call(0x439110, "Fat",true);
            add_cheat_call(0x439150, "Max Muscle",true);
            add_cheat_call(0x439190, "Skinny",true);
            add_cheat_flag(0x969171, "Never Wanted",true);
            add_cheat_call(0x4396F0, "Six Star Wanted Level",true);
            add_cheat_flag(0x96917F, "Max Respect ###",true);
            add_cheat_flag(0x969180, "Max Sex Appeal ###",true);
            add_cheat_call(0x439930, "Max Stamina ###",true);
            add_cheat_call(0x439940, "Hitman In All Weapon Stats",true);
            add_cheat_call(0x439A10, "Max All Vehicle Skill Stats",true);
            add_cheat_flag(0x969174, "NEVER GET HUNGRY",true);
    }
    if (last_selected[2] == 3) {
        //=============================================  
            add_cheat_call(0x43A4A0, "Spawn Rhino",true);
            add_cheat_call(0x43A4B0, "Spawn Bloodring Banger",true);
            add_cheat_call(0x43A4C0, "Spawn Rancher",true);
            add_cheat_call(0x43A4D0, "Spawn RacecarA",true);
            add_cheat_call(0x43A4E0, "Spawn RacecarB",true);
            add_cheat_call(0x43A4F0, "Spawn Romero",true);
            add_cheat_call(0x43A500, "Spawn Stretch",true);
            add_cheat_call(0x43A510, "Spawn Trashmaster",true);
            add_cheat_call(0x43A520, "Spawn Caddy",true);
            add_cheat_call(0x43A530, "Spawn Hydra",true);
            add_cheat_call(0x43A540, "Spawn Vortex Hovercraft",true);
            add_cheat_call(0x4395B0, "Have Parachute",true);
            add_cheat_call(0x439600, "Have Jetpack",true);
            add_cheat_call(0x43A550, "Spawn Hunter",true);
            add_cheat_call(0x43A560, "Spawn Quad",true);
            add_cheat_call(0x43A570, "Spawn Tanker Truck",true);
            add_cheat_call(0x43A660, "Spawn Dozer",true);
            add_cheat_call(0x43A670, "Spawn Stunt Plane",true);
            add_cheat_call(0x43A680, "Spawn Monster",true);
    }
    if (last_selected[2] == 4) {
        //=============================================
        //=============================================
            add_cheat_call(0x439D80, "Blow Up All Cars",true);
            add_cheat_flag(0x96914B, "Invisible car",true);
            add_cheat_flag(0x96914C, "Perfect Handling",true);
            add_cheat_flag(0x96914E, "All green lights",true);
            add_cheat_flag(0x96914F, "Aggressive Drivers",true);
            add_cheat_flag(0x969150, "Pink traffic",true);
            add_cheat_flag(0x969151, "Black traffic",true);
            add_cheat_flag(0x969153, "Boats fly",true);
            add_cheat_flag(0x96915E, "Traffic is Cheap Cars",true);
            add_cheat_flag(0x96915F, "Traffic is Fast Cars",true);
            add_cheat_flag(0x969160, "Cars Fly",true);
            add_cheat_flag(0x969164, "Smash n' Boom",true);
            add_cheat_flag(0x969165, "All Cars Have Nitro",true);
            add_cheat_flag(0x969166, "Cars Float Away When Hit",true);
            add_cheat_flag(0x969179, "Free Aim While Driving",true);
            add_cheat_flag(0x96917B, "Reduced Traffic",true);
            add_cheat_flag(0x96917A, "Traffic is Country Vehicles",true);
            add_cheat_flag(0x96917D, "Country Vehicles and Peds",true);
            add_cheat_flag(0x969152, "CARS Drive On Water",true);
    }
    if (last_selected[2] == 5) {
        //=============================================
            add_cheat_call(0x438F90, "Faster Gameplay",true);
            add_cheat_call(0x438FC0, "Slower Gameplay",true);
            add_cheat_flag(0x96913E, "Peds Attack Each Other, Get Golf Club",true);
            add_cheat_flag(0x96913F, "Have a bounty on your head",true);
            add_cheat_flag(0x969140, "Everyone is armed",true);
            add_cheat_call(0x438FF0, "Suicide",true);
            add_cheat_flag(0x969157, "Elvis Everywhere",true);
            add_cheat_flag(0x969158, "Peds Attack You With Rocket Launcher",true);
            add_cheat_flag(0x969159, "Beach Party",true);
            add_cheat_flag(0x96915A, "Gang Members Everywhere",true);
            add_cheat_flag(0x96915B, "Gangs Control the Streets",true);
            add_cheat_flag(0x96915C, "Ninja Theme",true);
            add_cheat_flag(0x96915D, "Slut Magnet",true);
            add_cheat_flag(0x969161, "Huge Bunny Hop",true);
            add_cheat_flag(0x96916C, "Mega Jump",true);
            add_cheat_flag(0x969175, "RIOT",true);
            add_cheat_flag(0x969176, "0x96917D, Funhouse Theme",true);
            add_cheat_flag(0x96917C, "Recruit Anyone (9mm)",true);
            add_cheat_flag(0x96917E, "Recruit Anyone (Rockets)",true);
            add_cheat_flag(0x96917D, "Recruit Anyone (AK47)",true);
            add_cheat_flag(0x969173, "MEGA PUNCH",true);
            add_cheat_flag(0x96918A, "Prostitutes pay you",true);
            add_cheat_flag(0x96918B, "All taxis have nitrous",true);
    }
    if (last_selected[2] == 6) {
        //=============================================  
            add_cheat_call(0x438F40, "Sunny WeatheR",true);
            add_cheat_call(0x438F50, "Very Sunny Weather",true);
            add_cheat_call(0x438F60, "Overcast Weather",true);
            add_cheat_call(0x438F70, "Rainy Weather",true);
            add_cheat_call(0x438F80, "Foggy Weather",true);
            add_cheat_call(0x438F90, "OR 0x96913B = Faster Clock",true);
            add_cheat_call(0x439510, "Always Midnight",true);
            add_cheat_flag(0x969168, "Orange Sky 21:00",true);
            add_cheat_call(0x439570, "Thunderstorm",true);
            add_cheat_call(0x439590, "Sandstorm",true);
    }
			}
		}
	}
    return;
}
